#ifndef AHXGWNET_THREAD_H_
#define AHXGWNET_THREAD_H_

#include <linux/unistd.h>

namespace ahxgwnet {

class Thread
{
public:
    Thread();
    void start(Runnable *runnable, void *args);
    void join();
    void *getArgs();
    int getPid();
    Runnable *getRunnable();
    static void *hook(void *arg);
    
private:
#ifdef _syscall0
    static _syscall0(pid_t, gettid)
#else
    static pid_t gettid() {return syscall(__NR_gettid);}
#endif
    
private:
    pthread_t   m_tid;
    int         m_pid;
    Runnable    *m_runnable;
    void        *m_args;
};

}

#endif
